package io.ouka.pub.judge;


import io.ouka.pub.exception.ArgumentException;
import io.ouka.pub.exception.BaseException;
import io.ouka.pub.exceptionenum.IResponseEnum;

import java.text.MessageFormat;

/**
 * Description:
 * User: Ouka
 * Date: 2020-04-26
 * Time: 23:27
 */
public interface CommonExceptionAssert extends IResponseEnum, Assert {

    @Override
    default BaseException newException(Object... args) {
        String msg = MessageFormat.format(this.getMsg(), args);

        return new ArgumentException(this, args, msg);
    }

    @Override
    default BaseException newException(Throwable t, Object... args) {
        String msg = MessageFormat.format(this.getMsg(), args);

        return new ArgumentException(this, args, msg, t);
    }

}
